class Dep {
  constructor() {
    // 订阅数组
    this.subs = [];
  }

  // 添加订阅
  addSub (watcher) {
    this.subs.push(watcher);
  }

  // 将消息通知给所有人
  notify () {
    this.subs.forEach(watcher => watcher.update());
  }
}